package com.sci.feign.impl;

import com.sci.entity.Business;
import com.sci.entity.Food;
import com.sci.feign.BusinessServiceClient;
import org.springframework.stereotype.Component;

@Component
public class BusinessServiceClientFallback implements BusinessServiceClient {
    @Override
    public Food getFoodById(int foodId) {
        // 返回默认食品信息
        Food food = new Food();
        food.setFoodName("未知商品");
        food.setPrice(0.0);
        return food;
    }

    @Override
    public Business getBusinessById(String businessId) {
        // 返回安全的默认商家对象
        Business business = new Business();
        business.setBusinessId("DEFAULT_BUSINESS_ID");  // 可选：设置默认ID
        business.setBusinessName("商家信息暂不可用");
        business.setAddress("地址信息暂不可用");
        business.setType(0);  // 其他必要字段初始化
        business.setRating(0.0);
        business.setHead("默认头像");
        return business;
    }

}
